home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / coreaids.zip / OPEN.ASM < prev    next >
Assembly Source File  |  1987-06-25  |  967b  |  40 lines

  1. ;    DESC:    Opens a file                                         V1.00
  2. ;    IN:    *{SEG_VAL} segment and
  3. ;        *{OFFSET} offset of filename as ASCIIZ strng
  4. ;        *{ACC_CODE} access code of file (0:read,1:write,2:read write)
  5. ;    OUT:    *{HANDLE} handle of file
  6. ;    SAMPLE:    Callm    OPEN,<SEG_VAL,OFFSET,ACC_CODE>,<HANDLE>
  7.     ##################################################################### 
  8.  
  9.     Extrn    PUSHALL:Near
  10.     Extrn    POPALL:Near
  11.     Extrn    ERRORMSG:Near
  12.  
  13. OPENC    Segment
  14.     Assume    CS:OPENC
  15.     Public    OPEN
  16.                         ;notice.
  17.     DB    'OPEN     - V1.00, Copyright 1987, CoreTechs   ',0DH,0AH
  18.  
  19. OPEN    Proc    Near                ;opens a file.
  20.     Call    PUSHALL
  21.  
  22.     Pop    AX                ;get the access code.
  23.     Pop    DX                ;get the filename offset.
  24.     Pop    DS                ;get the segment offset.
  25.  
  26.     Mov    AH,3DH                ;open a file.
  27.     Int    21H
  28.     Jc    ERROR                ;if an error report it.
  29.  
  30.     Push    AX                ;if no error return handle.
  31.     Call    POPALL
  32.     Ret
  33.  
  34. ERROR:    Push    AX                ;report error and abort.
  35.     Call    ERRORMSG
  36.  
  37. OPEN    Endp
  38. OPENC    Ends
  39.     End
  40.